<template>
	<view>
		<view class="header">
			快来和心仪的设计师开始思想碰撞之旅吧！
		</view>
		<view class="subsection">
			<view class="subsection-title">
				<u-subsection :list="list" :current="0" @change="sectionChange"></u-subsection>
			</view>
			<view class="subsection-content">
				<view class="subsection-date">
					<view class="year">
						<view style="background-color: #eee;width: 140rpx;border-radius: 6rpx;">2022年</view>
						<view>一</view>
						<view>二</view>
						<view>三</view>
						<view>四</view>
						<view>五</view>
						<view>六</view>
						<view>日</view>
					</view>
					<view class="month">
						<view style="background-color: #eee;width: 140rpx;border-radius: 6rpx;">11月</view>
						<view>10</view>
						<view>11</view>
						<view style="background-color: #d6d6d6;">12</view>
						<view>13</view>
						<view>14</view>
						<view>15</view>
						<view>16</view>
					</view>
				</view>
				<view v-show="current === 0">
					<view class="main-flex" style="
					background-color: #f8f8f8;height: 60rpx;line-height: 60rpx;
					border-radius: 6px;margin-top: 20rpx;">
						<view style="font-weight: 800;margin-right: 30rpx;">预约时间</view>
						<view style="width: 180rpx;background-color: #E7551C;border:1px solid #E7551C;color: #fff;text-align: center;">上午</view>
						<view style="width: 180rpx;background-color: #fff;border:1px solid #E7551C;color: #E7551C;text-align: center;border-right: none;">下午</view>
						<view style="width: 180rpx;background-color: #fff;border:1px solid #E7551C;color: #E7551C;text-align: center;">晚上</view>
					</view>
					<view>
						<view style="margin-top: 40rpx;padding-bottom: 20rpx;border-bottom: 1px solid #eee;position: relative;">
							<view style="display: flex;">
								<image
								style="width: 120rpx;height: 120rpx;border-radius: 100%;"
								src="https://media.citymiai.com/images/BEenwbzr6MgLsDyZNieiAb1rhRqaKH6cPFpdBrAA.png-avatar200"></image>
								<view style="margin-left: 20rpx;">
									<view style="margin-top: 20rpx;font-weight: 600;">孙佳佳</view>
								</view>
								<view style="position: absolute;top:40rpx;right: 20rpx;
								width: 120rpx;
								padding: 6rpx 0;
								border-radius: 12rpx;
								text-align: center;
								border: 1px solid #E7551C;
								color:#E7551C;"
								@click="yuyue">
									预约
								</view>
							</view>
							<view class="main-flex" style="
							height: 60rpx;line-height: 60rpx;
							border-radius: 6px;margin-top: 20rpx;font-size: 12px;">
								<view style="width: 180rpx;background-color: #E7551C;border:1px solid #E7551C;color: #fff;text-align: center;">08:00-09:00</view>
								<view style="width: 180rpx;background-color: #fff;border:1px solid #999;color: #999;text-align: center;border-right: none;">09:00-10:00</view>
								<view style="width: 180rpx;background-color: #fff;border:1px solid #999;color: #999;text-align: center;border-right: none;">10:00-11:00</view>
								<view style="width: 180rpx;background-color: #fff;border:1px solid #999;color: #999;text-align: center;">11:00-12:00</view>
							</view>
						</view>
						<view style="margin-top: 40rpx;padding-bottom: 20rpx;border-bottom: 1px solid #eee;position: relative;">
							<view style="display: flex;">
								<image
								style="width: 120rpx;height: 120rpx;border-radius: 100%;"
								src="https://media.citymiai.com/shaoxing/album/ZOwQiJC0htbqZHczn1124rFx0LxBjOAXMdZdvehR.png-avatar200"></image>
								<view style="margin-left: 20rpx;">
									<view style="margin-top: 20rpx;font-weight: 600;">胡彦斌</view>
								</view>
								<view style="position: absolute;top:40rpx;right: 20rpx;
								width: 120rpx;
								padding: 6rpx 0;
								border-radius: 12rpx;
								text-align: center;
								border: 1px solid #E7551C;
								color:#E7551C;"
								@click="yuyue">
									预约
								</view>
							</view>
							<view class="main-flex" style="
							height: 60rpx;line-height: 60rpx;
							border-radius: 6px;margin-top: 20rpx;font-size: 12px;">
								<view style="width: 180rpx;background-color: #E7551C;border:1px solid #E7551C;color: #fff;text-align: center;">08:00-09:00</view>
								<view style="width: 180rpx;background-color: #fff;border:1px solid #999;color: #999;text-align: center;border-right: none;">09:00-10:00</view>
								<view style="width: 180rpx;background-color: #fff;border:1px solid #999;color: #999;text-align: center;border-right: none;">10:00-11:00</view>
								<view style="width: 180rpx;background-color: #fff;border:1px solid #999;color: #999;text-align: center;">11:00-12:00</view>
							</view>
						</view>
						<view style="margin-top: 40rpx;padding-bottom: 20rpx;border-bottom: 1px solid #eee;position: relative;">
							<view style="display: flex;">
								<image
								style="width: 120rpx;height: 120rpx;border-radius: 100%;"
								src="https://media.citymiai.com/images/M1KfGxE3bXFuXXszOOXYha0CGznHSagEQqi0ipKo.png-avatar200"></image>
								<view style="margin-left: 20rpx;">
									<view style="margin-top: 20rpx;font-weight: 600;">王二美</view>
								</view>
								<view style="position: absolute;top:40rpx;right: 20rpx;
								width: 120rpx;
								padding: 6rpx 0;
								border-radius: 12rpx;
								text-align: center;
								border: 1px solid #E7551C;
								color:#E7551C;"
								@click="yuyue">
									预约
								</view>
							</view>
							<view class="main-flex" style="
							height: 60rpx;line-height: 60rpx;
							border-radius: 6px;margin-top: 20rpx;font-size: 12px;">
								<view style="width: 180rpx;background-color: #fff;border:1px solid #999;color: #999;text-align: center;border-right: none;">08:00-09:00</view>
								<view style="width: 180rpx;background-color: #E7551C;border:1px solid #E7551C;color: #fff;text-align: center;">09:00-10:00</view>
								<view style="width: 180rpx;background-color: #fff;border:1px solid #999;color: #999;text-align: center;border-right: none;">10:00-11:00</view>
								<view style="width: 180rpx;background-color: #fff;border:1px solid #999;color: #999;text-align: center;">11:00-12:00</view>
							</view>
						</view>
					</view>
				</view>
				<view v-show="current === 1">
					<view>
						<view style="margin-top: 40rpx;padding-bottom: 20rpx;border-bottom: 1px solid #eee;">
							<view style="display: flex;position: relative;">
								<image
								style="width: 80rpx;height: 80rpx;border-radius: 100%;"
								src="https://media.citymiai.com/images/BEenwbzr6MgLsDyZNieiAb1rhRqaKH6cPFpdBrAA.png-avatar200"></image>
								<view style="margin-left: 20rpx;">
									<view style="
									background-color: #e7b476;
									padding: 20rpx;
									border-radius: 6rpx;
									">设计师 孙佳佳 2022-11-13 08:00-08:30</view>
								</view>
								<view style="position: absolute;right: 0;
								color: #E7551C;
								width: 160rpx;line-height: 80rpx;height: 80rpx;
								transform:rotate(-30deg)">
									<u-icon name="star-fill" color="#E7551C" size="38"></u-icon>
									即将开始
								</view>
							</view>
						</view>
						<view style="margin-top: 40rpx;padding-bottom: 20rpx;border-bottom: 1px solid #eee;">
							<view style="display: flex;">
								<image
								style="width: 80rpx;height: 80rpx;border-radius: 100%;"
								src="https://media.citymiai.com/shaoxing/album/ZOwQiJC0htbqZHczn1124rFx0LxBjOAXMdZdvehR.png-avatar200"></image>
								<view style="margin-left: 20rpx;">
									<view style="
									background-color: #eee;
									padding: 20rpx;
									border-radius: 6rpx;
									">设计师 孙佳佳 2022-11-13 08:00-08:30</view>
								</view>
								<view style="position: absolute;right: 0;
								color: #999;
								width: 160rpx;line-height: 80rpx;height: 80rpx;
								transform:rotate(-30deg)">
									<u-icon name="star-fill" color="#999" size="38"></u-icon>
									已结束
								</view>
							</view>
						</view>
						<view style="margin-top: 40rpx;padding-bottom: 20rpx;border-bottom: 1px solid #eee;">
							<view style="display: flex;">
								<image
								style="width: 80rpx;height: 80rpx;border-radius: 100%;"
								src="https://media.citymiai.com/images/M1KfGxE3bXFuXXszOOXYha0CGznHSagEQqi0ipKo.png-avatar200"></image>
								<view style="margin-left: 20rpx;">
									<view style="
									background-color: #e7b476;
									padding: 20rpx;
									border-radius: 6rpx;
									">设计师 孙佳佳 2022-11-13 08:00-08:30</view>
								</view>
								<view style="position: absolute;right: 0;
								color: #E7551C;
								width: 160rpx;line-height: 80rpx;height: 80rpx;
								transform:rotate(-30deg)">
									<u-icon name="star-fill" color="#E7551C" size="38"></u-icon>
									即将开始
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [
					{
						name: '我的预约'
					}, 
					{
						name: '预约历史'
					}
				],
				current: 0
			}
		},
		onLoad() {
			this.checkToken()
		},
		methods: {
			sectionChange(index) {
				this.current = index;
				console.log(this.current);
			},
			checkToken(){
				// 判断是否有token
				let lifeData = uni.getStorageSync('lifeData');
				let token = lifeData.vuex_token
				if(!token){
					// 没有token 则跳转到登录
					return uni.reLaunch({
						url:'../login/login'
					})
				}
			},
			yuyue(){
				this.$mytip.toast('预约')
			}
		}
	}
</script>

<style>
	page{
		background-color:#FFFFFF;
	}
</style>
<style lang="scss" scoped>
.header{
	width: 100%;
	height: 100rpx;
	line-height: 100rpx;
	padding-left:20rpx ;
	color: #eee;
	background-color:#e7b476;
}

.subsection-content{
	padding: 20rpx;
	.subsection-date{
		.year{
			display: flex;
			view{
				text-align: center;
				width: 100rpx;
				height: 60rpx;
				line-height: 60rpx;
			}
		}
		.month{
			margin-top: 10rpx;
			display: flex;
			view{
				text-align: center;
				width: 100rpx;
				height: 60rpx;
				line-height: 60rpx;
				border-radius: 6rpx;
			}
		}
	}
}
</style>
